package furns.service.impl;

import furns.dao.MemberDAO;
import furns.dao.impl.MemberDAOImpl;
import furns.entity.Member;
import furns.service.MemberService;

public class MemberServiceImpl implements MemberService {
    private MemberDAO memberDAO = new MemberDAOImpl();

    //查询
    @Override
    public boolean isExistsUsername(String username) {
        Member member = memberDAO.queryMemberByUsername(username);
        return member == null ? false : true;

    }

    //注册
    @Override
    public boolean registerMember(Member member) {
        return memberDAO.saveMember(member) == 1 ? true:false;
    }

    @Override
    public Member login(Member member) {
       return memberDAO.queryMemberByUsernameAndPassword(member.getUsername(),member.getPassword());
    }
}
